/*
 * BugetItemDialog.h
 *
 *  Created on: 2013-2-4
 *      Author: Dspark
 */

#ifndef BUGETITEMDIALOG_H_
#define BUGETITEMDIALOG_H_

#include <qwidget.h>
#include <qlineedit.h>
#include <qradiobutton.h>
#include <qgridlayout.h>
#include <qtextedit.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include "../bo/BugetItem.h"
#include "component/CostTypeCombox.h"

Q_DECLARE_METATYPE(BugetItem)
Q_DECLARE_METATYPE(BugetItem*)

class BugetItemDialog : public QWidget {
	Q_OBJECT
public:
	BugetItemDialog(BugetItem* it = 0);
	virtual ~BugetItemDialog();
Q_SIGNALS:
	void sig_itemAdded(BugetItem* item,bool conbine=true);
	void sig_itemUpdate(BugetItem* item);
protected Q_SLOTS:
	void slt_radioToggled();
	void slt_save();
protected:
	bool isInvalid();
	QGridLayout grid;
	CostTypeCombox combox;
	QLineEdit value;
	QLabel lab_type,lab_value,lab_unit;
	QRadioButton conbine, extra;
	QTextEdit comment;
	QPushButton submit;
	BugetItem* item;
};

#endif /* BUGETITEMDIALOG_H_ */
